package school;

/**
 * 课程类：封装课程属性，关联授课教师（Teacher对象）
 */
public class Course {
    // 课程属性：private修饰，通过Getter暴露访问接口（封装原则）
    private String courseId;    // 课程编号
    private String courseName;  // 课程名称
    private String location;    // 上课地点
    private String time;        // 上课时间
    private int credit;         // 学分
    private Teacher teacher;    // 授课教师（关联Teacher类）

    /**
     * 全参构造方法：初始化课程所有属性
     */
    public Course(String courseId, String courseName, String location, String time, int credit, Teacher teacher) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.location = location;
        this.time = time;
        this.credit = credit;
        this.teacher = teacher;
    }

    // Getter方法：提供属性访问接口（外部类通过Getter获取私有属性）
    public String getCourseId() {
        return courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public String getLocation() {
        return location;
    }

    public String getTime() {
        return time;
    }

    public int getCredit() {
        return credit;
    }

    public Teacher getTeacher() {
        return teacher;
    }
}